/*    */ package com.zimbra.cs.service.admin;
/*    */ 
/*    */ import com.zimbra.common.account.Key.ServerBy;
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.soap.AdminConstants;
/*    */ import com.zimbra.common.soap.Element;
/*    */ import com.zimbra.common.util.Log;
/*    */ import com.zimbra.common.util.ZimbraLog;
/*    */ import com.zimbra.cs.account.AccountServiceException;
/*    */ import com.zimbra.cs.account.Provisioning;
/*    */ import com.zimbra.cs.account.Server;
/*    */ import com.zimbra.cs.account.accesscontrol.AdminRight;
/*    */ import com.zimbra.cs.account.accesscontrol.Rights.Admin;
/*    */ import com.zimbra.soap.ZimbraSoapContext;
/*    */ import java.util.List;
/*    */ import java.util.Map;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public final class ModifyServer
/*    */   extends AdminDocumentHandler
/*    */ {
/* 40 */   private static final String[] TARGET_SERVER_PATH = { "id" };
/*    */   
/*    */   protected String[] getProxiedServerPath()
/*    */   {
/* 44 */     return TARGET_SERVER_PATH;
/*    */   }
/*    */   
/*    */   public Element handle(Element request, Map<String, Object> context) throws ServiceException
/*    */   {
/* 49 */     ZimbraSoapContext zsc = getZimbraSoapContext(context);
/* 50 */     Provisioning prov = Provisioning.getInstance();
/*    */     
/* 52 */     String id = request.getAttribute("id");
/* 53 */     Map<String, Object> attrs = AdminService.getAttrs(request);
/*    */     
/* 55 */     Server server = prov.get(Key.ServerBy.id, id);
/* 56 */     if (server == null) {
/* 57 */       throw AccountServiceException.NO_SUCH_SERVER(id);
/*    */     }
/* 59 */     checkRight(zsc, context, server, attrs);
/*    */     
/*    */ 
/* 62 */     prov.modifyAttrs(server, attrs, true);
/*    */     
/* 64 */     ZimbraLog.security.info(ZimbraLog.encodeAttrs(new String[] { "cmd", "ModifyServer", "name", server.getName() }, attrs));
/*    */     
/*    */ 
/* 67 */     Element response = zsc.createElement(AdminConstants.MODIFY_SERVER_RESPONSE);
/* 68 */     GetServer.encodeServer(response, server);
/* 69 */     return response;
/*    */   }
/*    */   
/*    */   public void docRights(List<AdminRight> relatedRights, List<String> notes)
/*    */   {
/* 74 */     notes.add(String.format("All attrs provided in the attribute list have to settable by. the authed admin.   You can grant the %s right, which allows setting all attributes on %s, or grant the set attrs right just for the attributes the admin needs to set while creating an entry.", new Object[] { Rights.Admin.R_modifyServer.getName(), "server" }));
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/service/admin/ModifyServer.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */